package src.origintrail;

/**
 *Abstract superclass Item  
 * @author csmythe
 */
public abstract class Item {
    /**
     * How many of this item exist in the stack
     */
    protected int stack;
    /**
     * How much an Item of this type costs
     */
    protected double value;
    /**
     * How heavy this Item is
     */
    protected int weight;
    /**
     * This Item's name
     */
    protected String name;
    
    /**
     * Blank constructor
     */
    public Item(){
        
    }
    /**
    *Initializer for an instance of Item
    *@param	stack	value containing the number of 
    *@param name	name of the item
    *@param weight	weight of the item
     *@param value	the value of the item
     * @return  this 
    */
    public Item initialize(int stack, String name, int weight, double value) {
        this.stack = stack;
        this.name = name;
        this.weight = weight;
        this.value = value;
        return this;
    }
    
    /**
     * Initializes this object
     * @param stack This item's new stack
     * @return this
     */
    public Item initialize(int stack){
        return initialize(stack, "", 0, 0);
    }
    /**
    *Method that applies a change in quantity of the items 
    *@param change the amount to change the quantity by 	
    */
    public void add(int change){
        if(this.stack + change >= 0)
            this.stack += change;
        else
            this.stack = 0;
    }
    /**
    * Method that returns the quantity of the stack of items
    * @return this.stack
    */
    public int getStack() {
        return stack;
    }
    /**
    * Method that sets the quantity of the stack of items
    * @param stack 
    */
    public void setStack(int stack) {
        this.stack = stack;
    }
    /**
    * Method that returns the weight of an item
    * 
    * @return this.weight
    */
    public int getWeight() {
        return weight;
    }
    /**
    *Method that sets the weight of an item
    * 
    * @param weight 
    */
    public void setWeight(int weight) {
        this.weight = weight;
    }
    /**
    *Method that returns the value of an item
    * 
    * @return this.value
    */	
    public double getValue() {
        return value;
    }
    /**
    *Method that sets the value of an item
    * 
    * @param value 
    */	
    public void setValue(double value) {
        this.value = value;
    }
    /**
    *Method that returns the name of an item
    * 
    * @return Item's name
    */
    public String getName() {
        return name;
    }
    /**
    *Method that sets the name of an item
    * 
    * @param name 
    */
    public void setName(String name) {
        this.name = name;
    }
}
